PROJECT(DPGMTracking)

cmake_minimum_required(VERSION 2.8)

FIND_PACKAGE(QT4 REQUIRED)

#message (STATUS ${QT_USE_FILE})
#C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/UseQt4.cmake
#message (STATUS ${QT_QTOPENGL_INCLUDE_DIR})#can be found in cmake

if (QT4_FOUND)
  message (STATUS "Looking for Qt4 - found")
  include (${QT_USE_FILE})
else ()
  message (STATUS "Looking for Qt4 - not found")
endif ()


#Find ITk folder
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
   INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
   MESSAGE(FATAL_ERROR
           "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)

find_package (Plastimatch)

#Find DCMTK
find_package(DCMTK REQUIRED)
LINK_DIRECTORIES("${DCMTK_DIR}/lib")

SET(DPGMTracking_SOURCES
	main.cpp
	dpgmtracking.cpp
	YK16GrayImage.cxx
	YKThreadGetImg.cpp
	YKThreadProcImg.cpp
	qyklabel.cpp
	qcustomplot.cpp
	snake.cpp
	glwidget.cpp
	DlgStructure3D.cxx
	)

SET(DPGMTracking_HEADERS
	dpgmtracking.h
	YK16GrayImage.h
	qyklabel.h
	qcustomplot.h
	YKThreadGetImg.h
	YKThreadProcImg.h
	snake.h
	glwidget.h
	DlgStructure3D.h
	)

SET(DPGMTracking_FORMS
	DPGMTracking.ui
	DlgStructure3D.ui
)

#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /subsystem:windows /ENTRY:mainCRTStartup")

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

QT4_WRAP_CPP(DPGMTracking_HEADERS_MOC ${DPGMTracking_SOURCES})
QT4_WRAP_CPP(DPGMTracking_HEADERS_MOC ${DPGMTracking_HEADERS})
QT4_WRAP_UI(DPGMTracking_FORMS_HEADERS ${DPGMTracking_FORMS})
#QT4_ADD_RESOURCES(DPGMTracking_RESOURCES_RCC ${DPGMTracking_RESOURCES})

ADD_EXECUTABLE(DPGMTracking ${DPGMTracking_SOURCES} 
	${DPGMTracking_HEADERS} 
    ${DPGMTracking_HEADERS_MOC} 
    ${DPGMTracking_FORMS_HEADERS} 
     )
#  ${DPGMTracking_RESOURCES_RCC}

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${PLASTIMATCH_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${QT_QTOPENGL_INCLUDE_DIR})

SET(QT_USE_QTCORE TRUE)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)


#TARGET_LINK_LIBRARIES(ItkCon ${ITK_LIBRARIES} )
TARGET_LINK_LIBRARIES(DPGMTracking
netapi32.lib
opengl32.lib
glu32.lib
${ITK_LIBRARIES}
${QT_LIBRARIES}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY}
${PLASTIMATCH_LIBRARIES}
)